import VectorLayer from "ol/layer/Vector";
import VectorSource from "ol/source/Vector";
import WFS from "ol/format/WFS";
import { bbox } from "ol/loadingstrategy";
import GeoJsonFormat from "ol/format/GeoJson";

const baseUrl = BASE_CONFIG.sliceService;

function getWFSLayer(shpServiceUrl: string, format = "", url = baseUrl) {
	format = format || "application/json";
	return new VectorLayer({
		source: new VectorSource({
			format: new GeoJsonFormat(),
			url: shpServiceUrl,
			strategy: bbox,
		}),
	});
}

export default {
	getWFSLayer,
};
